'use strict';
let mongoose = require('mongoose');

let schema = new mongoose.Schema({
    token:{
        type:String,
        default:''
    },
    nickName: String,
    openId: {
        type: String,
        default:''
    },
    gender: {
        type:Number,
        default:0
    },
    avatarUrl: String,
    language:{
        type:String,
        default:''
    },
    city:{
        type:String,
        default:''
    },
    province:{
        type:String,
        default:''
    },
    country:{
        type:String,
        default:''
    },
    //最后登陆时间戳，用于判断该用户何时最后在线
    lastLoginTimeTick:{
        type:Number,
        default:0
    },
    registerTimeTick:{
        type:Number,
        default:0
    },
    loginTimes:{
        type:Number,
        default:0
    },
    status:{
        type:Number,
        default:0  //0正常账户  1测试账户  2机器人陪玩账户
    },
    referrerInfoAppId:{
        type:String,
        default : '',
    },
    parentId : {
        type : String,
        default :'',
    },
});
schema.index({openId: 1}, {unique: true});

schema.statics = {
};

schema.methods = {
    notepad:require('./user.notepad'),
    getData(){
        return {a:1};
    }
};

module.exports = schema;